local dpqj = fk.CreateSkill {

  name = "joy_nian_dpqj",

  tags = {  },

}



dpqj:addEffect("active", {
  name = "joy_nian_dpqj",
  anim_type = "offensive",
  card_num = 0,
  target_num = 0,
  prompt = "你视为使用一张决斗，于此决斗结算结束前你的手牌均视为【杀】。",
  card_filter = Util.FalseFunc,
  target_filter = Util.FalseFunc,
  on_use = function(self, room, effect)
    local player = effect.from
    room:setPlayerMark(player,"joy_nian_dpqj-phase",1)
    U.askForUseVirtualCard(room, player, "duel", nil, dpqj.name)
    room:setPlayerMark(player,"joy_nian_dpqj-phase",0)
  end,
})

dpqj:addEffect("filter", {
  name = "#joy_nian_dpqj_filter",
  card_filter = function(self,card, player)
    return player:getMark("joy_nian_dpqj-phase") > 0 and table.contains(player.player_cards[Player.Hand], card.id)
  end,
  view_as = function(self, player,card)
    return Fk:cloneCard("slash", card.suit, card.number)
  end,
})

dpqj:addEffect(fk.CardUseFinished, {
  refresh_events = {fk.CardUseFinished},
  can_refresh = function (self, event, target, player, data)
     return target == player and player:getMark("joy_nian_dpqj-phase") > 0 and data.card and data.card.name == "duel" and data.skillName == "joy_nian_dpqj"
  end,
  on_refresh = function (self, event, target, player, data)
    player.room:setPlayerMark(player,"joy_nian_dpqj-phase",0)
  end,
})

return dpqj